﻿using System;
using System.Web.Mvc;

namespace Yz.Mvc.Controllers
{
    /// <summary>
    ///     根据Json字符串返回JS对象
    /// </summary>
    public class JsonStrResult : ActionResult
    {
        public string JsonData { get; set; }

        public override void ExecuteResult(ControllerContext context)
        {
            if (context == null) throw new ArgumentNullException("context");
            context.HttpContext.Response.ContentType = "application/json; charset=utf-8";
            context.HttpContext.Response.Write(JsonData);
        }
    }
}